{% extends 'frame.html' %}
{% block title %}Acdp Doc{% endblock %}
{% block main %}Acdp Markdown{% endblock %}

{% block body %}

<div style="width: 100%;">
    <article id='card' class="mdui-card mdui-center mdui-shadow-4 mdui-m-y-5 mdui-typo mdui-p-x-5 mdui-p-y-3" style="max-width: 820px; min-height: 1200px;">
        <div class="mdui-text-center"><div class="mdui-spinner mdui-spinner-colorful"></div></div>
    </article>
</div>
<div id="nid" class="mdui-hidden">{{data.nid}}</div>

<script src="{{ url_for('static', filename='js/showdown.min.js') }}"></script>
<script>
    function GetReadme(FN) {
        NowPage = FN;
        var xmlhttp;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {
            xmlhttp = new ActiveXObject('Microsoft.XMLHttp');
        }
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var converter = new showdown.Converter();
                var html = converter.makeHtml(xmlhttp.responseText);
                document.getElementById("card").innerHTML = html;
            }
        }
        xmlhttp.open('GET', FN, true);
        xmlhttp.send();
    }
    GetReadme('/api/down/?tar='+document.getElementById('nid').innerText);
</script>

{% endblock %}